```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>深入理解I/O模型</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        .hero {
            background: linear-gradient(135deg, #6e8efb 0%, #a777e3 100%);
        }
        .card {
            transition: all 0.3s ease;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
        }
        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
        }
        .section-title {
            position: relative;
            padding-bottom: 0.5rem;
        }
        .section-title:after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 50px;
            height: 3px;
            background: linear-gradient(90deg, #6e8efb 0%, #a777e3 100%);
        }
        .feature-icon {
            font-size: 2rem;
            margin-bottom: 1rem;
            background: linear-gradient(135deg, #6e8efb 0%, #a777e3 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }
        .dropdown-content {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.3s ease-out;
        }
        .dropdown.active .dropdown-content {
            max-height: 1000px;
        }
        .chart-container {
            background: #f8fafc;
            border-radius: 0.5rem;
            padding: 1.5rem;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero text-white py-20 px-4 md:px-0">
        <div class="container mx-auto max-w-5xl text-center">
            <h1 class="text-4xl md:text-5xl font-bold mb-6 font-serif">深入理解I/O模型</h1>
            <p class="text-xl md:text-2xl mb-8 max-w-3xl mx-auto">探索现代应用中的I/O处理机制与高并发解决方案</p>
            <div class="flex justify-center space-x-4">
                <a href="#overview" class="px-6 py-3 bg-white text-purple-600 rounded-full font-medium hover:bg-opacity-90 transition">开始阅读</a>
                <a href="#models" class="px-6 py-3 border border-white text-white rounded-full font-medium hover:bg-white hover:bg-opacity-10 transition">查看模型</a>
            </div>
        </div>
    </section>

    <!-- Overview Section -->
    <section id="overview" class="py-16 px-4 md:px-0">
        <div class="container mx-auto max-w-5xl">
            <h2 class="text-3xl font-bold mb-12 text-center font-serif section-title inline-block">I/O模型概述</h2>
            
            <div class="grid md:grid-cols-3 gap-8 mt-10">
                <div class="card bg-white p-6 rounded-lg">
                    <div class="feature-icon">
                        <i class="fas fa-exchange-alt"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3">I/O操作本质</h3>
                    <p class="text-gray-600">输入/输出操作是程序与外部世界交互的关键方式，涉及数据在内存和外部设备间的传输。</p>
                </div>
                
                <div class="card bg-white p-6 rounded-lg">
                    <div class="feature-icon">
                        <i class="fas fa-tachometer-alt"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3">性能关键</h3>
                    <p class="text-gray-600">I/O性能直接影响应用响应速度和吞吐量，合理的I/O模型选择对高并发系统至关重要。</p>
                </div>
                
                <div class="card bg-white p-6 rounded-lg">
                    <div class="feature-icon">
                        <i class="fas fa-project-diagram"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3">模型演进</h3>
                    <p class="text-gray-600">从阻塞到非阻塞，再到异步I/O，模型不断演进以适应更高性能、更高并发的需求。</p>
                </div>
            </div>
            
            <div class="mt-16 chart-container">
                <div class="mermaid">
                    graph TD
                    A[I/O模型] --> B[阻塞I/O]
                    A --> C[非阻塞I/O]
                    A --> D[选择器I/O]
                    A --> E[异步I/O]
                    A --> F[Reactor模型]
                    A --> G[Proactor模型]
                    B --> H[简单易用]
                    B --> I[线程阻塞]
                    C --> J[线程不阻塞]
                    C --> K[轮询机制]
                    D --> L[事件驱动]
                    D --> M[单线程多连接]
                    E --> N[异步回调]
                    E --> O[高吞吐量]
                    F --> P[事件分离]
                    F --> Q[高效处理]
                    G --> R[系统级异步]
                    G --> S[自动完成]
                </div>
            </div>
        </div>
    </section>

    <!-- Models Section -->
    <section id="models" class="py-16 px-4 md:px-0 bg-gray-100">
        <div class="container mx-auto max-w-5xl">
            <h2 class="text-3xl font-bold mb-12 text-center font-serif section-title inline-block">I/O模型详解</h2>
            
            <div class="space-y-8">
                <!-- Blocking I/O -->
                <div class="card bg-white rounded-lg overflow-hidden">
                    <div class="dropdown cursor-pointer p-6" onclick="toggleDropdown(this)">
                        <div class="flex justify-between items-center">
                            <div>
                                <h3 class="text-2xl font-bold text-purple-700">1. 阻塞 I/O（Blocking I/O）</h3>
                                <p class="text-gray-500 mt-1">同步阻塞模型，线程等待I/O操作完成</p>
                            </div>
                            <i class="fas fa-chevron-down text-purple-500 transition-transform"></i>
                        </div>
                        <div class="dropdown-content mt-4">
                            <div class="grid md:grid-cols-2 gap-6">
                                <div>
                                    <h4 class="font-bold text-lg mb-3 text-gray-800"><i class="fas fa-star text-yellow-400 mr-2"></i>特点</h4>
                                    <ul class="space-y-2">
                                        <li class="flex items-start">
                                            <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                            <span><span class="font-medium">阻塞行为：</span>在进行 I/O 操作时（如读取数据），线程会被阻塞，直到操作完成</span>
                                        </li>
                                        <li class="flex items-start">
                                            <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                            <span><span class="font-medium">简单易用：</span>编程模型简单，适合处理少量的连接或数据流</span>
                                        </li>
                                    </ul>
                                </div>
                                <div>
                                    <h4 class="font-bold text-lg mb-3 text-gray-800"><i class="fas fa-lightbulb text-blue-400 mr-2"></i>适用场景</h4>
                                    <ul class="space-y-2">
                                        <li class="flex items-start">
                                            <i class="fas fa-check-circle text-blue-500 mt-1 mr-2"></i>
                                            <span><span class="font-medium">简单应用：</span>适合连接数较少、对性能要求不高的应用场景</span>
                                        </li>
                                        <li class="flex items-start">
                                            <i class="fas fa-check-circle text-blue-500 mt-1 mr-2"></i>
                                            <span><span class="font-medium">小型服务：</span>适用于不需要高并发的简单网络服务</span>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <div class="mt-6 bg-gray-50 p-4 rounded">
                                <h4 class="font-bold text-lg mb-2 text-gray-800"><i class="fas fa-code text-purple-500 mr-2"></i>示例</h4>
                                <p class="text-gray-700">使用 <code class="bg-gray-200 px-2 py-1 rounded">Socket</code> 和 <code class="bg-gray-200 px-2 py-1 rounded">InputStream</code>/<code class="bg-gray-200 px-2 py-1 rounded">OutputStream</code> 进行数据读取和写入</p>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- Non-Blocking I/O -->
                <div class="card bg-white rounded-lg overflow-hidden">
                    <div class="dropdown cursor-pointer p-6" onclick="toggleDropdown(this)">
                        <div class="flex justify-between items-center">
                            <div>
                                <h3 class="text-2xl font-bold text-purple-700">2. 非阻塞 I/O（Non-Blocking I/O）</h3>
                                <p class="text-gray-500 mt-1">线程不等待I/O操作完成，可继续执行其他任务</p>
                            </div>
                            <i class="fas fa-chevron-down text-purple-500 transition-transform"></i>
                        </div>
                        <div class="dropdown-content mt-4">
                            <div class="grid md:grid-cols-2 gap-6">
                                <div>
                                    <h4 class="font-bold text-lg mb-3 text-gray-800"><i class="fas fa-star text-yellow-400 mr-2"></i>特点</h4>
                                    <ul class="space-y-2">
                                        <li class="flex items-start">
                                            <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                            <span><span class="font-medium">非阻塞行为：</span>线程可以在 I/O 操作期间继续执行其他任务，而不需要等待 I/O 完成</span>
                                        </li>
                                        <li class="flex items-start">
                                            <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                            <span><span class="font-medium">轮询：</span>通常需要通过轮询机制检查 I/O 操作的完成状态</span>
                                        </li>
                                    </ul>
                                </div>
                                <div>
                                    <h4 class="font-bold text-lg mb-3 text-gray-800"><i class="fas fa-lightbulb text-blue-400 mr-2"></i>适用场景</h4>
                                    <ul class="space-y-2">
                                        <li class="flex items-start">
                                            <i class="fas fa-check-circle text-blue-500 mt-1 mr-2"></i>
                                            <span><span class="font-medium">中等并发：</span>适用于中等规模的并发连接场景，性能比阻塞 I/O 更高</span>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <div class="mt-6 bg-gray-50 p-4 rounded">
                                <h4 class="font-bold text-lg mb-2 text-gray-800"><i class="fas fa-code text-purple-500 mr-2"></i>示例</h4>
                                <p class="text-gray-700">使用 <code class="bg-gray-200 px-2 py-1 rounded">java.nio</code> 包中的 <code class="bg-gray-200 px-2 py-1 rounded">SocketChannel</code> 和 <code class="bg-gray-200 px-2 py-1 rounded">Selector</code> 进行非阻塞 I/O 操作</p>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- Selector I/O -->
                <div class="card bg-white rounded-lg overflow-hidden">
                    <div class="dropdown cursor-pointer p-6" onclick="toggleDropdown(this)">
                        <div class="flex justify-between items-center">
                            <div>
                                <h3 class="text-2xl font-bold text-purple-700">3. 选择器 I/O（Selector I/O）</h3>
                                <p class="text-gray-500 mt-1">事件驱动的高效I/O模型</p>
                            </div>
                            <i class="fas fa-chevron-down text-purple-500 transition-transform"></i>
                        </div>
                        <div class="dropdown-content mt-4">
                            <div class="grid md:grid-cols-2 gap-6">
                                <div>
                                    <h4 class="font-bold text-lg mb-3 text-gray-800"><i class="fas fa-star text-yellow-400 mr-2"></i>特点</h4>
                                    <ul class="space-y-2">
                                        <li class="flex items-start">
                                            <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                            <span><span class="font-medium">事件驱动：</span>通过 <code class="bg-gray-200 px-1 py-0.5 rounded">Selector</code> 进行事件驱动的 I/O 操作，能够监控多个通道（Channel）的状态变化</span>
                                        </li>
                                        <li class="flex items-start">
                                            <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                            <span><span class="font-medium">高效的资源利用：</span>允许单个线程管理多个连接，减少了线程切换的开销</span>
                                        </li>
                                    </ul>
                                </div>
                                <div>
                                    <h4 class="font-bold text-lg mb-3 text-gray-800"><i class="fas fa-lightbulb text-blue-400 mr-2"></i>适用场景</h4>
                                    <ul class="space-y-2">
                                        <li class="flex items-start">
                                            <i class="fas fa-check-circle text-blue-500 mt-1 mr-2"></i>
                                            <span><span class="font-medium">高并发：</span>适合高并发的网络应用，如 Web 服务器和聊天服务</span>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <div class="mt-6 bg-gray-50 p-4 rounded">
                                <h4 class="font-bold text-lg mb-2 text-gray-800"><i class="fas fa-code text-purple-500 mr-2"></i>示例</h4>
                                <p class="text-gray-700">使用 <code class="bg-gray-200 px-2 py-1 rounded">java.nio.channels.Selector</code> 结合 <code class="bg-gray-200 px-2 py-1 rounded">SocketChannel</code> 进行高效的 I/O 操作</p>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- Asynchronous I/O -->
                <div class="card bg-white rounded-lg overflow-hidden">
                    <div class="dropdown cursor-pointer p-6" onclick="toggleDropdown(this)">
                        <div class="flex justify-between items-center">
                            <div>
                                <h3 class="text-2xl font-bold text-purple-700">4. 异步 I/O（Asynchronous I/O）</h3>
                                <p class="text-gray-500 mt-1">基于回调的高性能I/O模型</p>
                            </div>
                            <i class="fas fa-chevron-down text-purple-500 transition-transform"></i>
                        </div>
                        <div class="dropdown-content mt-4">
                            <div class="grid md:grid-cols-2 gap-6">
                                <div>
                                    <h4 class="font-bold text-lg mb-3 text-gray-800"><i class="fas fa-star text-yellow-400 mr-2"></i>特点</h4>
                                    <ul class="space-y-2">
                                        <li class="flex items-start">
                                            <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                            <span><span class="font-medium">异步回调：</span>I/O 操作在后台进行，线程不会阻塞，完成后通过回调机制通知应用</span>
                                        </li>
                                        <li class="flex items-start">
                                            <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                            <span><span class="font-medium">高效处理：</span>能够处理大量并发连接，适合需要高吞吐量的应用场景</span>
                                        </li>
                                    </ul>
                                </div>
                                <div>
                                    <h4 class="font-bold text-lg mb-3 text-gray-800"><i class="fas fa-lightbulb text-blue-400 mr-2"></i>适用场景</h4>
                                    <ul class="space-y-2">
                                        <li class="flex items-start">
                                            <i class="fas fa-check-circle text-blue-500 mt-1 mr-2"></i>
                                            <span><span class="font-medium">大规模并发：</span>适用于需要处理大量并发连接和高吞吐量的应用，如大规模的实时数据处理系统</span>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <div class="mt-6 bg-gray-50 p-4 rounded">
                                <h4 class="font-bold text-lg mb-2 text-gray-800"><i class="fas fa-code text-purple-500 mr-2"></i>示例</h4>
                                <p class="text-gray-700">使用 <code class="bg-gray-200 px-2 py-1 rounded">java.nio.channels.AsynchronousSocketChannel</code> 进行异步 I/O 操作，或使用 Netty 的异步编程模型</p>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- Reactor Model -->
                <div class="card bg-white rounded-lg overflow-hidden">
                    <div class="dropdown cursor-pointer p-6" onclick="toggleDropdown(this)">
                        <div class="flex justify-between items-center">
                            <div>
                                <h3 class="text-2xl font-bold text-purple-700">5. Reactor 模型</h3>
                                <p class="text-gray-500 mt-1">经典的事件驱动架构</p>
                            </div>
                            <i class="fas fa-chevron-down text-purple-500 transition-transform"></i>
                        </div>
                        <div class="dropdown-content mt-4">
                            <div class="grid md:grid-cols-2 gap-6">
                                <div>
                                    <h4 class="font-bold text-lg mb-3 text-gray-800"><i class="fas fa-star text-yellow-400 mr-2"></i>特点</h4>
                                    <ul class="space-y-2">
                                        <li class="flex items-start">
                                            <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                            <span><span class="font-medium">事件驱动：</span>将 I/O 事件与事件处理器分离，通过事件循环处理 I/O 事件</span>
                                        </li>
                                        <li class="flex items-start">
                                            <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                            <span><span class="font-medium">高效处理：</span>适合大规模的网络应用，能够处理大量并发连接</span>
                                        </li>
                                    </ul>
                                </div>
                                <div>
                                    <h4 class="font-bold text-lg mb-3 text-gray-800"><i class="fas fa-lightbulb text-blue-400 mr-2"></i>适用场景</h4>
                                    <ul class="space-y-2">
                                        <li class="flex items-start">
                                            <i class="fas fa-check-circle text-blue-500 mt-1 mr-2"></i>
                                            <span><span class="font-medium">高性能应用：</span>如 Web 服务器、消息中间件和其他需要高并发处理的应用</span>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <div class="mt-6 bg-gray-50 p-4 rounded">
                                <h4 class="font-bold text-lg mb-2 text-gray-800"><i class="fas fa-code text-purple-500 mr-2"></i>示例</h4>
                                <p class="text-gray-700">Netty 和 Java NIO 的 Selector 实现了 Reactor 模型</p>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- Proactor Model -->
                <div class="card bg-white rounded-lg overflow-hidden">
                    <div class="dropdown cursor-pointer p-6" onclick="toggleDropdown(this)">
                        <div class="flex justify-between items-center">
                            <div>
                                <h3 class="text-2xl font-bold text-purple-700">6. Proactor 模型</h3>
                                <p class="text-gray-500 mt-1">系统级异步I/O处理</p>
                            </div>
                            <i class="fas fa-chevron-down text-purple-500 transition-transform"></i>
                        </div>
                        <div class="dropdown-content mt-4">
                            <div class="grid md:grid-cols-2 gap-6">
                                <div>
                                    <h4 class="font-bold text-lg mb-3 text-gray-800"><i class="fas fa-star text-yellow-400 mr-2"></i>特点</h4>
                                    <ul class="space-y-2">
                                        <li class="flex items-start">
                                            <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                            <span><span class="font-medium">异步事件处理：</span>与 Reactor 模型不同，Proactor 模型将 I/O 操作的完成交给操作系统，通过异步事件通知机制处理</span>
                                        </li>
                                        <li class="flex items-start">
                                            <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                            <span><span class="font-medium">自动化：</span>操作系统负责完成 I/O 操作，应用只需要处理完成后的事件</span>
                                        </li>
                                    </ul>
                                </div>
                                <div>
                                    <h4 class="font-bold text-lg mb-3 text-gray-800"><i class="fas fa-lightbulb text-blue-400 mr-2"></i>适用场景</h4>
                                    <ul class="space-y-2">
                                        <li class="flex items-start">
                                            <i class="fas fa-check-circle text-blue-500 mt-1 mr-2"></i>
                                            <span><span class="font-medium">高效的异步应用：</span>适用于需要高效处理 I/O 完成事件的应用</span>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <div class="mt-6 bg-gray-50 p-4 rounded">
                                <h4 class="font-bold text-lg mb-2 text-gray-800"><i class="fas fa-code text-purple-500 mr-2"></i>示例</h4>
                                <p class="text-gray-700">使用异步 I/O 相关的 API（如 <code class="bg-gray-200 px-2 py-1 rounded">AsynchronousSocketChannel</code>）进行事件处理</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Comparison Section -->
    <section class="py-16 px-4 md:px-0">
        <div class="container mx-auto max-w-5xl">
            <h2 class="text-3xl font-bold mb-12 text-center font-serif section-title inline-block">模型对比</h2>
            
            <div class="overflow-x-auto">
                <table class="min-w-full bg-white rounded-lg overflow-hidden">
                    <thead class="bg-purple-600 text-white">
                        <tr>
                            <th class="py-3 px-4 text-left">模型</th>
                            <th class="py-3 px-4 text-left">阻塞类型</th>
                            <th class="py-3 px-4 text-left">线程使用</th>
                            <th class="py-3 px-4 text-left">复杂度</th>
                            <th class="py-3 px-4 text-left">适用场景</th>
                        </tr>
                    </thead>
                    <tbody class="divide-y divide-gray-200">
                        <tr class="hover:bg-purple-50 transition">
                            <td class="py-4 px-4 font-medium">阻塞I/O</td>
                            <td class="py-4 px-4">阻塞</td>
                            <td class="py-4 px-4">多线程</td>
                            <td class="py-4 px-4">低</td>
                            <td class="py-4 px-4">低并发简单应用</td>
                        </tr>
                        <tr class="hover:bg-purple-50 transition">
                            <td class="py-4 px-4 font-medium">非阻塞I/O</td>
                            <td class="py-4 px-4">非阻塞</td>
                            <td class="py-4 px-4">多线程</td>
                            <td class="py-4 px-4">中</td>
                            <td class="py-4 px-4">中等并发应用</td>
                        </tr>
                        <tr class="hover:bg-purple-50 transition">
                            <td class="py-4 px-4 font-medium">选择器I/O</td>
                            <td class="py-4 px-4">非阻塞</td>
                            <td class="py-4 px-4">单/多线程</td>
                            <td class="py-4 px-4">中高</td>
                            <td class="py-4 px-4">高并发服务</td>
                        </tr>
                        <tr class="hover:bg-purple-50 transition">
                            <td class="py-4 px-4 font-medium">异步I/O</td>
                            <td class="py-4 px-4">非阻塞</td>
                            <td class="py-4 px-4">单/多线程</td>
                            <td class="py-4 px-4">高</td>
                            <td class="py-4 px-4">超高并发系统</td>
                        </tr>
                        <tr class="hover:bg-purple-50 transition">
                            <td class="py-4 px-4 font-medium">Reactor</td>
                            <td class="py-4 px-4">非阻塞</td>
                            <td class="py-4 px-4">单/多线程</td>
                            <td class="py-4 px-4">高</td>
                            <td class="py-4 px-4">高性能网络服务</td>
                        </tr>
                        <tr class="hover:bg-purple-50 transition">
                            <td class="py-4 px-4 font-medium">Proactor</td>
                            <td class="py-4 px-4">异步</td>
                            <td class="py-4 px-4">单/多线程</td>
                            <td class="py-4 px-4">高</td>
                            <td class="py-4 px-4">高效异步处理</td>
                        </tr>
                    </tbody>
                </table>
            </div>
            
            <div class="mt-16 chart-container">
                <div class="mermaid">
                    timeline
                        title I/O模型演进时间线
                        2002 : JDK 1.4 : NIO (Selector I/O)
                        2004 : Netty 1.0 : Reactor实现
                        2011 : JDK 7 : Asynchronous I/O
                        2014 : Netty 4.0 : 优化Reactor模型
                </div>
            </div>
        </div>
    </section>

    <!-- Footer -->
    <footer class="bg-gray-900 text-white py-8">
        <div class="container mx-auto max-w-5xl px-4 md:px-0">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h3 class="text-xl font-bold">技术小馆</h3>
                    <p class="text-gray-400 mt-1">探索技术之美</p>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="text-purple-300 hover:text-white transition underline">http://www.yuque.com/jtostring</a>
                </div>
            </div>
            <div class="mt-8 pt-6 border-t border-gray-800 text-center text-gray-500 text-sm">
                &copy; 2023 技术小馆. 保留所有权利.
            </div>
        </div>
    </footer>

    <script>
        // Toggle dropdown
        function toggleDropdown(element) {
            element.classList.toggle('active');
            const icon = element.querySelector('i');
            if (element.classList.contains('active')) {
                icon.style.transform = 'rotate(180deg)';
            } else {
                icon.style.transform = 'rotate(0deg)';
            }
        }
        
        // Initialize Mermaid
        document.addEventListener('DOMContentLoaded', function() {
            mermaid.initialize({
                startOnLoad: true,
                theme: 'default',
                flowchart: {
                    useMaxWidth: false,
                    htmlLabels: true
                }
            });
        });
        
        // Smooth scrolling for anchor links
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });
        
        // Auto-expand first dropdown
        setTimeout(() => {
            const firstDropdown = document.querySelector('.dropdown');
            if (firstDropdown) {
                firstDropdown.classList.add('active');
                firstDropdown.querySelector('i').style.transform = 'rotate(180deg)';
            }
        }, 300);
    </script>
</body>
</html>
```